//---------------------------------------------------------------------------

#ifndef MotionHMIH
#define MotionHMIH

#define HMI_R_LENGTH			6
#define HMI_SBC_LENGTH		5

typedef enum
{
	SCHEDULE_SWITCH				= 254,
	REMOTE_MOITON					= 252,
	REMOTE_HEAD_MODE			= 251,
	REMOTE_HEAD_POSITION	= 250,
	RETURN_MOTOR_READ			= 248,
	//GET_DMA_FLAG					= 247, // Used in STM32
	GET_MOTOR_DATA				= 246,
	GET_SCHEDULE_INDEX		= 245,
	GET_SCHEDULE_DATA			= 244,
	DEBUG_INST_BOUND			= 240
} DebugInstruction;

typedef struct
{
	unsigned char Buff[HMI_RX_BUFF_SIZE];
	int NowIndex;
	int EndIndex;
} HMIRXStruct;

// The other instructions are defined for MotorSchedule in "Motor.h":
//		INSERT_DELAY_COUNT 	->	255
//		SET_STEP_TIME				->	253
//		SET_POSITION				->	MOTOR_NUM
//		SET_TORQUE					->	MOTOR_NUM + TORQUE_BASE

void HMI_Init(void);
// Used when communicate with HMI through RS232
bool HMIRX2Receive(void);
void AccessHMIReceive(void);
// Used when communicate with HMI through Share memory
void HMI_StoreToShareM(void);
void HMI_LoadFromShareM(void);

//---------------------------------------------------------------------------
#endif
